package org.example.RabbitListener;

import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
public class SpringRabbitListener 
{
	@RabbitListener(bindings = {
			@QueueBinding(
					value = @Queue(value = "xiri.queue",durable = "true"),
					exchange = @Exchange(value = "xiri.direct",type = ExchangeTypes.DIRECT),
					key = "key"
			)
	})
	public void listener1(String mes) throws Exception {
		System.out.println("消费者1接受消息："+mes);
//		throw new Exception("测试消息丢失");
	}
}
